local sk__jianwu = fk.CreateSkill {

  name = "sk__jianwu",

  tags = { Skill.Compulsory, },

}



sk__jianwu:addEffect(fk.AfterCardUseDeclared, {
  name = "sk__jianwu",
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__jianwu.name) and player:getMark("@@sk__jianwu") > 0 and
        data.card.trueName == "slash"
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@sk__jianwu", 0)
    if not data.extraUse then
      player:addCardUseHistory(data.card.trueName, -1)
      data.extraUse = true
    end
  end,
})
sk__jianwu:addEffect(fk.EventLoseSkill, {
  can_refresh = function(self, event, target, player, data)
    if target == player then
      return data.skill == self
    end
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@sk__jianwu", 0)
  end,
})
sk__jianwu:addEffect(fk.CardUseFinished, {
  can_refresh = function(self, event, target, player, data)
    if target == player then
      return player:hasSkill(sk__jianwu.name)
    end
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@sk__jianwu", data.card.type == Card.TypeBasic and 1 or 0)
  end,
})

sk__jianwu:addEffect("targetmod", {
  name = "#sk__jianwu_targetmod",
  bypass_times = function(self, player, skill, scope)
    return player:hasSkill(sk__jianwu.name) and skill.trueName == "slash_skill" and player:getMark("@@sk__jianwu") > 0 and
        scope == Player.HistoryPhase
  end,
  bypass_distances = function(self, player, skill)
    return player:hasSkill(sk__jianwu.name) and skill.trueName == "slash_skill" and player:getMark("@@sk__jianwu") > 0
  end,
  extra_target_func = function(self, player, skill)
    if player:hasSkill(sk__jianwu.name) and skill.trueName == "slash_skill" and player:getMark("@@sk__jianwu") > 0 then
      return 1
    end
  end,
})

return sk__jianwu
